package com.div.compiler

import com.google.auto.common.BasicAnnotationProcessor
import com.google.auto.service.AutoService
import com.google.common.collect.ImmutableList
import javax.annotation.processing.Processor
import javax.lang.model.SourceVersion
import javax.tools.Diagnostic

//@AutoService(Processor::class)
class CompilerProcessor: BasicAnnotationProcessor() {
    override fun initSteps(): MutableIterable<BasicAnnotationProcessor.ProcessingStep> {
        info("CompilerProcessor initSteps")
        return ImmutableList.of(InjectGenerater(processingEnv));
    }

    override fun getSupportedSourceVersion(): SourceVersion? {
        info("TracelessCompilerProcessor GetSupportedSourceVersion = %s", SourceVersion.latestSupported().toString())
        return SourceVersion.latestSupported()
    }

    fun info(msg: String, vararg args: Any) {
        processingEnv.messager.printMessage(Diagnostic.Kind.NOTE, String.format(msg, args))
    }
}